package com.crm.business.crm.service.impl;


import cn.hutool.core.convert.Convert;
import com.crm.business.crm.mapper.HpCrmLeadsDistributionRecordMapper;
import com.crm.common.crm.entity.BO.HpCrmLeadsDistributionRecordBO;
import com.crm.common.crm.entity.VO.HpCrmLeadsDistributionRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


/**
 * 线索分配记录Service业务层处理
 *
 * @author beiluo
 * @date 2021-06-18
 */
@Service
public class HpCrmLeadsDistributionRecordServiceImpl
{
    @Autowired
    private HpCrmLeadsDistributionRecordMapper hpCrmLeadsDistributionRecordMapper;

    /**
     * 查询线索分配记录
     *
     * @param id 线索分配记录ID
     * @return 线索分配记录
     */
    public HpCrmLeadsDistributionRecordVO selectHpCrmLeadsDistributionRecordById(Long id)
    {
        return hpCrmLeadsDistributionRecordMapper.selectHpCrmLeadsDistributionRecordById(id);
    }

    /**
     * 查询线索分配记录列表
     *
     * @param hpCrmLeadsDistributionRecord 线索分配记录
     * @return 线索分配记录
     */
    public List<HpCrmLeadsDistributionRecordVO> selectHpCrmLeadsDistributionRecordList(HpCrmLeadsDistributionRecordBO hpCrmLeadsDistributionRecord)
    {
        return hpCrmLeadsDistributionRecordMapper.selectHpCrmLeadsDistributionRecordList(hpCrmLeadsDistributionRecord);
    }

    /**
     * 新增线索分配记录
     *
     * @param hpCrmLeadsDistributionRecord 线索分配记录
     * @return 结果
     */
    public int insertHpCrmLeadsDistributionRecord(HpCrmLeadsDistributionRecordBO hpCrmLeadsDistributionRecord)
    {
        hpCrmLeadsDistributionRecord.setCreateTime(new Date());
        hpCrmLeadsDistributionRecord.setUpdateTime(new Date());
        return hpCrmLeadsDistributionRecordMapper.insertHpCrmLeadsDistributionRecord(hpCrmLeadsDistributionRecord);
    }

    /**
     * 修改线索分配记录
     *
     * @param hpCrmLeadsDistributionRecord 线索分配记录
     * @return 结果
     */
    public int updateHpCrmLeadsDistributionRecord(HpCrmLeadsDistributionRecordBO hpCrmLeadsDistributionRecord)
    {
        hpCrmLeadsDistributionRecord.setUpdateTime(new Date());
        return hpCrmLeadsDistributionRecordMapper.updateHpCrmLeadsDistributionRecord(hpCrmLeadsDistributionRecord);
    }

    /**
     * 删除线索分配记录对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteHpCrmLeadsDistributionRecordByIds(String ids)
    {
        return hpCrmLeadsDistributionRecordMapper.deleteHpCrmLeadsDistributionRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除线索分配记录信息
     *
     * @param id 线索分配记录ID
     * @return 结果
     */
    public int deleteHpCrmLeadsDistributionRecordById(Long id)
    {
        return hpCrmLeadsDistributionRecordMapper.deleteHpCrmLeadsDistributionRecordById(id);
    }
}
